@*
* Copyright 2016 LinkedIn Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*@

@import com.linkedin.drelephant.analysis.Metrics;

<p>
  The Used Resources metric shows the resources used by your job in GB Hours. </br>
</p>

<h4> Calculation </h4>
<div>
    We define resource usage of a task as the product of container size of the task and the runtime of the task.</br>
    The resource usage of a job can thus be defined as the sum of resource usage of all the mapper tasks and all the reducer tasks.
</div>

<h4> Example</h4>
Consider a job with: </br>
4 mappers with runtime {12, 15, 20, 30} mins. </br>
4 reducers with runtime {10 , 12, 15, 18} mins. </br>
Container size of 4 GB </br>
Then, </br>
Resource used by all mappers: 4 * (( 12 + 15 + 20 + 30 ) / 60 ) GB Hours = 5.133 GB Hours </br>
Resource used by all reducers: 4 * (( 10 + 12 + 15 + 18 ) / 60 ) GB Hours = 3.666 GB Hours </br>
Total resource used by the job = <i>5.133 + 3.6666 = 8.799 GB Hours</i> </br>

